﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Globalization;

namespace Wormhole.UI.Application
{
	/// <summary>
	/// Interaction logic for CardDetails.xaml
	/// </summary>
	public partial class CardDetails : Window
	{
		#region Constructor
		/// <summary>
		/// Initialize a default instance of the class.
		/// </summary>
		public CardDetails()
		{
			InitializeComponent();
		}

		//public CardDetails(string imagePath)
		//    : this()
		//{
		//    Image contentImage = new Image();
		//    BitmapImage imageSource = new BitmapImage(new Uri(imagePath, UriKind.Relative));
		//    imageSource.BaseUri = new Uri("pack://application:,,,/Wormhole.UI.Application;component/controls/score.xaml");

		//    contentImage.Source = imageSource;
		//    contentImage.Height = imageSource.Height;
		//    contentImage.Width = imageSource.Width;
		//    this.Content = contentImage;
		//}

		#endregion

		#region Event Handlers

		#region Mouse Left Button Up
		/// <summary>
		/// Close the dialog when the user click on it.
		/// </summary>
		/// <param name="e"></param>
		protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
		{
			this.Hide();
			base.OnMouseLeftButtonUp(e);
		}
		#endregion

		#endregion

		#region Show Details
		/// <summary>
		/// Display a full size image of a card.
		/// </summary>
		/// <param name="card">The card to display the details for.</param>
		public void ShowDetails(Engine.CardLibrary.BaseCardTypes.Card card)
		{
			this.Left = 300;
			this.Top = 300;

			//Image contentImage = new Image();
			BitmapImage imageSource = new BitmapImage(card.ImageUri);

			this.cardImage.Source = imageSource;
			this.cardImage.Height = imageSource.Height;
			this.cardImage.Width = imageSource.Width;
			this.cardImage.Stretch = Stretch.None;

			// when I set this the image appears washed out
			//this.outsideBorder.Width = this.cardImage.Width + 15;
			//this.outsideBorder.Height = this.cardImage.Height + 13;
			this.Show();
		}
		#endregion
	}
}
